package com.can.entity;

import com.can.common.constant.UserEnum;
import com.can.common.validate.InsertValidate;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description 用户实体
 * @Author can
 * @Date 2018/8/28
 * @Version 1.0
 */
public class User implements Serializable {
    private Integer id;
    @NotBlank(message="用户名不能为空")
    /** 账号 **/
    private String account;
    @NotBlank(message="密码不能为空")
    /** 密码 **/
    private String password;
    /** 机密盐 **/
    private String salt;
    /** 部门id **/
    private Integer deptId;
    /** 状态(1:启用  2:冻结  3:删除） **/
    private Integer status;
    /** 创建时间 **/
    private Date createTime;
    /** 当前登录时间 **/
    private Date loginTime;
    /** 上一次登录时间 **/
    private Date lastLoginTime;
    /** 登录次数 **/
    private Integer times;
    /** 所属单位 **/
    private String unitId;

    public User() {
        this.createTime = new Date();
        this.loginTime = new Date();
        this.lastLoginTime = new Date();
    }

    public User(String account, String password, String salt, String unitId) {
        this.account = account;
        this.password = password;
        this.salt = salt;
        this.createTime = new Date();
        this.loginTime = new Date();
        this.lastLoginTime = new Date();
        this.unitId = unitId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public Integer getTimes() {
        return times;
    }

    public void setTimes(Integer times) {
        this.times = times;
    }

    public String getUnitId() {
        return unitId;
    }

    public void setUnitId(String unitId) {
        this.unitId = unitId;
    }
}
